const STATE_START = 0;
const STATE_IN_JSO = 1;
const STATE_IN_QUOTE = 2;

const REGEX_JS_PARTTERN = ".*/MicroStrategy.*";

// Get statistical data from document.
var REGEX_WebStat = /Web server processing time : (\d+) milliseconds.*/;
var REGEX_WebTransStat = /Transmission Time : (\d+) milliseconds.*/;
var REGEX_ISrvrStat = /IServer processing Time : (\d+) milliseconds.*/;
var REGEX_TotalXMLAPICalls = /Number of Web API calls : (\d+)/;
var REGEX_PollingXMLAPICalls = /Number of Web API polling calls : (\d+)/;
var REGEX_BytesSent = /Bytes sent\/received : (\d+) \d+/;
var REGEX_BytesRecv = /Bytes sent\/received : \d+ (\d+)/;


// Messaging Constants.
const PORT_NAME_CONTENT_PAGE = "port_name_content_page";
const PORT_NAME_EXTENSION_PAGE = "port_name_extension_page";
const MSG_TYPE_INIT = "msg_type_init";
const MSG_TYPE_START_MONITORING = "msg_type_start_monitoring";
const MSG_TYPE_STOP_MONITORING = "msg_type_stop_monitoring";
const MSG_TYPE_DUMP_DATA = "msg_type_dump_data";
const MSG_TYPE_LOG = "msg_type_log";
const MSG_TYPE_DEBUG = "msg_type_debug";
const MSG_TYPE_ERROR = "msg_type_error";
const MSG_TYPE_CLICKED = "msg_type_clicked";
const MSG_TYPE_GET_STATS = "msg_type_get_stats";
const MSG_TYPE_STATS = "msg_type_stats";
const MSG_TYPE_CALLBACK_STARTED = "msg_type_callback_started";
const MSG_TYPE_START_CSPAT = "msg_type_start_cspat";
const MSG_TYPE_STOP_CSPAT = "msg_type_stop_cspat";
const MSG_TYPE_MONITOR_STAT = "msg_type_monitor_stat";
const MSG_TYPE_SET_SAMPLE = "msg_type_set_sample";
const MSG_TYPE_SET_FREQ = "msg_type_set_freq";
const MSG_TYPE_GET_FOCUS = "msg_type_get_focus";
const MSG_TYPE_GET_DATA = "msg_type_get_data";


// HTTP Header Names...
const HEADER_NAME_ISERVER_TOTAL	= "X-MSTRStat-IServer";
const HEADER_NAME_WEB_APP		= "X-MSTRStat-Web";
const HEADER_NAME_WEB_TRANS		= "X-MSTRStat-Trans";
const HEADER_NAME_TOTAL_CALLS	= "X-MSTRStat-TotCalls";
const HEADER_NAME_POLL_CALLS	= "X-MSTRStat-PollCalls";
const HEADER_NAME_BYTES_SENT	= "X-MSTRStat-BytesSent";
const HEADER_NAME_BYTES_RECV	= "X-MSTRStat-BytesRecv";
